<template>
  <div>
    <h3>{{ obj }}</h3>
    <h3>{{ num }}</h3>
    <button @click="btnClick">修改obj</button>
  </div>
</template>
<script>
export default {
  data () {
    return {
      obj: { a: 10 },
      num: 0
    }
  },
  watch: {
    $route: {},
    obj: {
      handler (newVal) {
        console.log(newVal)
      }
      //   deep: true
    },
    num: {
      handler (newVal) {
        console.log(newVal)
      }
    }
  },
  methods: {
    btnClick () {
      //   this.obj.a++
      this.obj = { a: Math.random() * 999 }
      //   this.num++
    }
  }
}
</script>
<style></style>
